package com.dly.hope.model.vo;

import com.dly.hope.modle.Group;
import com.dly.hope.modle.GroupUser;
import com.dly.hope.modle.UserAccount;
import lombok.Data;

@Data
public class GroupAddMessageVo {

    /**
     * 用户名
     */
    private String name;

    /**
     * 用户头像
     */
    private String userAvatar;

    /**
     * 群组头像
     */
    private String groupAvatar;

    /**
     * 群名
     */
    private String groupName;

    /**
     * 群主 如果群主是当前用户 表示申请
     * 如果不是表示是 邀请
     */
    private String groupMaster;

    /**
     * 添加记录
     */
    private String id;

    public static GroupAddMessageVo toVo(GroupUser groupUser, UserAccount userAccount, Group group){
        GroupAddMessageVo groupAddMessageVo = new GroupAddMessageVo();
        groupAddMessageVo.setGroupAvatar(group.getAvatar());
        groupAddMessageVo.setGroupName(group.getName());
        groupAddMessageVo.setGroupMaster(group.getGroupMaster());
        groupAddMessageVo.setId(groupUser.getId());
        groupAddMessageVo.setName(userAccount.getAccountName());
        groupAddMessageVo.setUserAvatar(userAccount.getAvatar());
        return groupAddMessageVo;
    }
}

